﻿@using ModelToDto
@{
    Layout = null;
    ViewData["Title"] = "后台用户登录";
}
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<style>
    .field-validation-error {
        color: red !important;
    }
</style>
@model LoginUserDTO
<div style="width:800px;height:500px;margin:auto;">

    @using (Html.BeginForm("Login", "Home", FormMethod.Post, new { @class = "row g-3" }))
    {

        <p></p>
        <h1>登录</h1>
        <p></p>
        <div class="row mb-2">
            @Html.LabelFor(c => c.Name, new { @class = "col-sm-2 col-form-label" })
            <div class="col-md-6">
                @Html.TextBoxFor(c => c.Name, new { @class = "form-control", @placeholder = "请输入用户名称" })
                @Html.ValidationMessageFor(c => c.Name)
            </div>
        </div>
        <div class="row mb-2">
            @Html.LabelFor(c => c.Password, new { @class = "col-sm-2 col-form-label" })
            <div class="col-md-6">
                @Html.PasswordFor(c => c.Password, new { @class = "form-control", @placeholder = "请输入密码" })
                @Html.ValidationMessageFor(c => c.Password)
            </div>
        </div>
        <div class="row mb-2">
            <div class="col-md-2">
                <img alt="验证码图片" width="117px" ;
                     height="30px" ; class="img" onclick="refresh(this)" src="/Home/VerifyCode" title="点击刷新">
            </div>
            <div class="col-md-6">
                @Html.TextBoxFor(c => c.CheckCode, new { @class = "form-control", @placeholder = "请输入验证码" })
                @Html.ValidationMessageFor(c => c.CheckCode)
            </div>
        </div>
        <div class="col-12">
            <button type="submit" class="btn btn-primary">提  交</button>
        </div>
    }
</div>

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script type="text/javascript">
    function refresh(obj) {
        $(obj).attr("src", "/Home/VerifyCode?random=" + Math.random());
    }
</script>
